package pages

// Upload page
var Upload = `
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
        crossorigin="anonymous">
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <title>qrcp</title>
    <style>
        body {
            margin: 10px;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="row">
            <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
                width="100%" viewBox="0 0 804.666 306.14" enable-background="new 0 0 804.666 306.14" xml:space="preserve">
                <g>
                    <g>
                        <polygon fill="#00AEEF" points="246.355,182.111 82.612,290.467 82.688,198.443 254.354,116.233 		" />
                    </g>
                    <g>
                        <g>
                            <g>
                                <g>
                                    <polygon fill="#F9ED32" points="31.388,227.121 154.208,165.906 158.21,181.887 250.908,132.033 250.911,171.207
                                386.376,31.251 284.368,75.32 284.368,37.369 195.419,82.664 177.044,36.152 31.388,91.638 					"
                                    />
                                </g>
                                <g>
                                    <path fill="#231F20" d="M26.388,235.199V88.193L179.88,29.721l18.17,45.992l91.318-46.502v38.502l118.027-50.989
                                L245.912,183.561l-0.003-43.162l-90.988,48.933l-4.052-16.176L26.388,235.199z M36.388,95.084v123.957l121.159-60.387
                                l3.952,15.785l94.408-50.773l0.003,35.185L365.356,45.779l-85.988,37.147v-37.4l-86.58,44.088l-18.58-47.031L36.388,95.084z"
                                    />
                                </g>
                            </g>
                        </g>
                    </g>
                    <g>
                        <g>
                            <g>
                                <path fill="#00AEEF" d="M217.093,114.078c0,7.662-5.496,15.098-11.062,17.955c-5.566,2.861-8.879,3.879-13.932,4.084
                            c-5.045,0.205-13.875-6.209-13.875-13.871V35.968c0-7.66,6.214-13.871,13.875-13.871h11.122c7.661,0,13.872,6.211,13.872,13.871
                            V114.078z" />
                            </g>
                        </g>
                        <g>
                            <g>
                                <path fill="#231F20" d="M191.862,141.427c-8.348,0-18.938-9.035-18.938-19.182V35.968c0-10.574,8.604-19.18,19.174-19.18h11.122
                            c10.575,0,19.177,8.605,19.177,19.18v78.109c0,10.186-7.014,19.117-13.945,22.678c-6.338,3.254-10.411,4.43-16.136,4.662
                            C192.162,141.421,192.015,141.427,191.862,141.427z M192.099,27.4c-4.723,0-8.565,3.844-8.565,8.568v86.277
                            c0,4.402,6.062,8.57,8.329,8.57h0.021c4.183-0.168,6.7-0.922,11.721-3.5c3.939-2.02,8.189-7.654,8.189-13.238V35.968
                            c0-4.725-3.849-8.568-8.573-8.568H192.099z" />
                            </g>
                        </g>
                    </g>
                    <g>
                        <g>
                            <g>
                                <path fill="#00AEEF" d="M258.661,93.66c0,7.914-2.922,13.332-7.207,17.977c-4.081,4.428-10.127,9.779-17.783,9.779
                            c-7.662,0-13.875-6.211-13.875-13.871V45.755c0-7.66,6.213-13.871,13.875-13.871h11.121c7.661,0,13.869,6.211,13.869,13.871
                            V93.66z" />
                            </g>
                        </g>
                        <g>
                            <g>
                                <path fill="#231F20" d="M233.671,126.718c-10.576,0-19.178-8.605-19.178-19.174V45.755c0-10.568,8.602-19.174,19.178-19.174
                            h11.121c10.574,0,19.178,8.605,19.178,19.174V93.66c0,8.346-2.738,15.199-8.615,21.572
                            C252.731,118.074,244.761,126.718,233.671,126.718z M233.671,37.193c-4.725,0-8.568,3.846-8.568,8.562v61.789
                            c0,4.725,3.844,8.562,8.568,8.562c4.397,0,8.809-2.562,13.885-8.066c4.066-4.41,5.803-8.713,5.803-14.381V45.755
                            c0-4.717-3.841-8.562-8.566-8.562H233.671z" />
                            </g>
                        </g>
                    </g>
                    <g>
                        <g>
                            <g>
                                <path fill="#00AEEF" d="M175.526,128.376c0,7.66-6.21,13.873-13.879,13.873H150.53c-7.661,0-13.871-6.213-13.871-13.873V33.933
                            c0-7.66,6.21-13.871,13.871-13.871h11.117c7.669,0,13.879,6.211,13.879,13.871V128.376z" />
                            </g>
                        </g>
                        <g>
                            <g>
                                <path fill="#231F20" d="M161.647,147.554H150.53c-10.57,0-19.174-8.605-19.174-19.178V33.933c0-10.572,8.604-19.18,19.174-19.18
                            h11.117c10.58,0,19.182,8.607,19.182,19.18v94.443C180.829,138.949,172.228,147.554,161.647,147.554z M150.53,25.363
                            c-4.725,0-8.566,3.848-8.566,8.57v94.443c0,4.725,3.842,8.568,8.566,8.568h11.117c4.729,0,8.574-3.844,8.574-8.568V33.933
                            c0-4.723-3.846-8.57-8.574-8.57H150.53z" />
                            </g>
                        </g>
                    </g>
                    <g>
                        <g>
                            <g>
                                <path fill="#00AEEF" d="M133.958,115.712c0,7.66-6.211,13.871-13.871,13.871h-8.676c-7.66,0-13.87-6.211-13.87-13.871V45.771
                            c0-7.662,6.21-13.873,13.87-13.873h8.676c7.66,0,13.871,6.211,13.871,13.873V115.712z" />
                            </g>
                        </g>
                        <g>
                            <g>
                                <path fill="#231F20" d="M120.087,134.884h-8.676c-10.57,0-19.174-8.6-19.174-19.172V45.771c0-10.576,8.604-19.182,19.174-19.182
                            h8.676c10.572,0,19.174,8.605,19.174,19.182v69.941C139.261,126.285,130.659,134.884,120.087,134.884z M111.411,37.201
                            c-4.721,0-8.566,3.842-8.566,8.57v69.941c0,4.725,3.846,8.568,8.566,8.568h8.676c4.721,0,8.565-3.844,8.565-8.568V45.771
                            c0-4.729-3.845-8.57-8.565-8.57H111.411z" />
                            </g>
                        </g>
                    </g>
                    <g>
                        <g>
                            <g>
                                <path fill="#00AEEF" d="M83.612,222.221V108.378l85.373-53.645c0,0,14.189,23.855-2.943,41.402
                            c-17.142,17.547-29.383,22.033-29.383,22.033s29.383,29.385,21.627,67.336" />
                            </g>
                        </g>
                        <g>
                            <g>
                                <path fill="#231F20" d="M83.612,291.561c-2.929,0-5.305-2.373-5.305-5.303V105.445l92.459-58.098l2.777,4.676
                            c5.627,9.463,12.094,31.637-3.71,47.816c-10.362,10.605-19.106,16.703-24.712,19.971c8.459,10.633,24.678,35.84,18.361,66.758
                            c-0.586,2.867-3.387,4.719-6.258,4.135c-2.869-0.584-4.721-3.393-4.135-6.26c7.097-34.756-19.906-62.254-20.182-62.524
                            l-5.873-5.877l7.795-2.855c0.092-0.031,11.52-4.488,27.412-20.758c5.785-5.92,7.975-13.449,6.52-22.369
                            c-0.478-2.912-1.277-5.531-2.062-7.627L88.918,111.31v174.948C88.918,289.188,86.542,291.561,83.612,291.561z"
                                />
                            </g>
                        </g>
                    </g>
                </g>
                <g>
                    <path d="M410.02,168.978l-2.75,13.86h-25.96l3.08-15.511c-14.63-4.84-23.21-16.72-23.21-32.01c0-27.17,20.24-46.09,48.51-46.09
                c23.979,0,39.05,14.19,39.05,34.43C448.74,147.527,433.12,165.127,410.02,168.978z M422.56,125.197c0-8.91-5.61-14.96-15.07-14.96
                c-12.76,0-20.13,10.89-20.13,23.541c0,8.91,5.61,14.96,15.07,14.96C415.19,148.737,422.56,137.847,422.56,125.197z"
                    />
                    <path d="M510.229,145.547l12.87,22.44h-26.95l-10.89-19.36h-6.381l-3.85,19.36h-25.96l15.399-77h34.541
                c20.35,0,32.01,9.35,32.01,25.3C531.019,130.037,523.319,140.597,510.229,145.547z M495.048,111.007h-8.689l-3.63,18.04h10.67
                c7.149,0,11.33-3.74,11.33-10.23C504.729,113.317,500.989,111.007,495.048,111.007z" />
                    <path d="M551.147,126.847h33.001l-3.74,18.7h-33L551.147,126.847z" />
                    <path d="M580.847,126.847h33l-3.74,18.7h-33L580.847,126.847z" />
                    <path d="M360.923,216.9l-0.146,0.807h9.387l-2.054,10.414h-9.02l-5.573,27.866h-13.934l5.574-27.866h-5.867l2.126-10.414h5.867
                l0.293-1.613c1.833-9.094,8.066-15.18,18.7-15.18c3.74,0,7.187,0.732,9.606,2.127l-5.353,9.753
                c-1.173-0.733-2.567-1.173-4.107-1.173C363.343,211.621,361.729,213.307,360.923,216.9z M381.53,216.24h13.86l-7.92,39.747h-13.86
                L381.53,216.24z M399.423,203.7c0,4.767-3.593,8.14-9.02,8.14c-4.913,0-7.993-3.08-7.993-6.893c0-4.474,3.52-7.92,8.947-7.92
                C396.27,197.027,399.423,199.887,399.423,203.7z" />
                    <path d="M407.342,201.574h13.934l-10.854,54.413h-13.934L407.342,201.574z" />
                    <path d="M463.587,239.561h-29.186c0.513,4.4,3.52,6.453,9.02,6.453c3.52,0,6.967-1.1,9.606-3.227l5.794,8.727
                c-4.987,3.667-10.928,5.134-16.94,5.134c-12.761,0-21.12-7.04-21.12-18.114c0-13.199,9.754-22.953,24.053-22.953
                c12.101,0,19.58,7.041,19.58,17.453C464.394,235.381,464.028,237.58,463.587,239.561z M435.208,232.227h16.353
                c0.073-4.253-2.933-6.746-7.407-6.746C439.46,225.48,436.528,228.268,435.208,232.227z" />
                    <path d="M488.375,241.174c-0.074,0.514-0.147,0.953-0.147,1.32c0,2.199,1.247,3.373,3.667,3.373c1.467,0,2.787-0.439,4.18-1.174
                l1.76,9.607c-2.934,1.687-6.673,2.347-10.34,2.347c-8.141,0-13.42-4.254-13.42-11.66c0-1.173,0.073-2.42,0.367-3.74l2.64-13.126
                h-5.866l2.126-10.414h5.794l2.053-10.34h13.934l-2.053,10.34h9.02l-2.054,10.414h-9.021L488.375,241.174z" />
                    <path d="M537.287,215.58l-2.42,12.541c-1.247-0.147-2.054-0.221-3.153-0.221c-6.087,0-9.974,2.713-11.294,9.313l-3.812,18.773
                h-13.934l7.92-39.747h13.199l-0.879,4.4C526.433,217.047,531.347,215.58,537.287,215.58z" />
                    <path d="M583.855,216.24l-7.921,39.747h-13.2l0.807-3.74c-3.08,2.86-6.894,4.4-11.514,4.4c-8.58,0-16.793-6.526-16.793-18.114
                c0-13.199,9.68-22.953,21.561-22.953c5.354,0,9.68,1.613,12.173,5.428l0.953-4.768H583.855z M566.328,234.354
                c0-4.619-2.787-7.627-7.554-7.627c-5.5,0-9.46,4.475-9.46,11.147c0,4.62,2.787,7.554,7.553,7.554
                C562.441,245.428,566.328,240.954,566.328,234.354z" />
                    <path d="M632.033,229.074c0,1.539-0.146,3.152-0.514,4.913l-4.398,22h-13.934l4.105-20.681c0.221-0.953,0.293-1.833,0.293-2.64
                c0-3.446-1.76-5.28-5.5-5.28c-4.766,0-8.066,2.86-9.312,8.947l-3.961,19.653H584.88l7.92-39.747H606l-0.807,4.107
                c3.52-3.301,8.066-4.768,12.467-4.768C626.166,215.58,632.033,220.2,632.033,229.074z" />
                    <path d="M634.234,252.761l5.059-9.753c3.668,2.346,9.094,3.666,13.787,3.666c4.547,0,6.381-1.1,6.381-2.859
                c0-4.547-20.607-0.367-20.607-13.787c0-9.533,9.166-14.447,21.193-14.447c5.646,0,11.221,1.174,15.107,3.154l-4.914,9.753
                c-3.887-2.347-8.287-3.007-11.807-3.007c-4.547,0-6.381,1.394-6.381,3.007c0,4.767,20.535,0.513,20.535,13.786
                c0,9.534-9.314,14.374-21.121,14.374C644.427,256.647,637.679,254.961,634.234,252.761z" />
                    <path d="M698.986,216.9l-0.146,0.807h9.387l-2.053,10.414h-9.02l-5.574,27.866h-13.934l5.574-27.866h-5.867l2.127-10.414h5.867
                l0.293-1.613c1.832-9.094,8.066-15.18,18.699-15.18c3.74,0,7.188,0.732,9.607,2.127l-5.354,9.753
                c-1.174-0.733-2.566-1.173-4.107-1.173C701.406,211.621,699.792,213.307,698.986,216.9z" />
                    <path d="M749.513,239.561h-29.188c0.514,4.4,3.52,6.453,9.02,6.453c3.521,0,6.967-1.1,9.607-3.227l5.793,8.727
                c-4.986,3.667-10.926,5.134-16.939,5.134c-12.76,0-21.121-7.04-21.121-18.114c0-13.199,9.754-22.953,24.055-22.953
                c12.1,0,19.58,7.041,19.58,17.453C750.32,235.381,749.953,237.58,749.513,239.561z M721.132,232.227h16.354
                c0.074-4.253-2.934-6.746-7.406-6.746C725.386,225.48,722.453,228.268,721.132,232.227z" />
                    <path d="M786.765,215.58l-2.42,12.541c-1.246-0.147-2.053-0.221-3.152-0.221c-6.088,0-9.975,2.713-11.295,9.313l-3.812,18.773
                h-13.934l7.92-39.747h13.201l-0.881,4.4C775.912,217.047,780.826,215.58,786.765,215.58z" />
                </g>
            </svg>
        </div>
        <div class="row">
            <form id="upload-form">
                <h3>Send files or text</h3>
                <div class="form-group">
                    <label for="files">
                        Files to transfer
                    </label>
                    <input class="form-control-file" type="file" id="files" name="files" multiple>
                </div>
                <div class="form-group form-check">
                    <input type="checkbox" class="form-check-input" id="check-send-text">
                    <label class="form-check-label" for="check-send-text">Show text options</label>
                </div>
                <div id="send-text-form" style="display: none">
                    <div class="form-group">
                        <label for="plaintext-title">
                            Title
                        </label>
                        <input class="form-control" id="plaintext-title">   
                    </div>
                    <div class="form-group">
                        <label for="plaintext-text">
                            Text
                        </label>
                        <textarea class="form-control" id="plaintext-text"></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <input class="btn btn-primary form-control form-control-lg" type="submit" 
                        id="submit" name="submit" value="Transfer">
                </div>
            </form>
        </div>
    </div>
    <script>
        var textCheckbox = document.getElementById('check-send-text')
        var textForm = document.getElementById('send-text-form')

        textCheckbox.onclick = function(e) {
            if (this.checked) {
                textForm.style.display = 'block'
            } else {
                textForm.style.display = 'none'
            }
        }
    </script>
    <script>
        var uploadForm = document.getElementById('upload-form')

        uploadForm.addEventListener('submit', function(e) {
            e.preventDefault()

            var xhr = new XMLHttpRequest()
            // Put the request response HTML ('Done' page) on the window 
            xhr.onreadystatechange = function() {
                if (xhr.readyState === 4) {
                    document.write(xhr.response)
                }
            }

            var formData = new FormData(uploadForm)
            var titleInput = document.getElementById('plaintext-title')
            var textInput = document.getElementById('plaintext-text')
            var textCheckbox = document.getElementById('check-send-text')

            if ((titleInput.value || textInput.value) && textCheckbox.checked) {
                var currentDate = new Date().toJSON().slice(0,19).replace(/[-T]/g,'_')
                // If the user didn't specify a file name, use 'qrcp-text-file-${currentDate}'
                var filename = titleInput.value || ("qrcp-text-file-" + currentDate)
                var blob = new Blob([textInput.value + '\n'], { type: "text/plain" })
                // Append the text file to the form data with '.txt' extension
                formData.append("textFile", blob, filename + ".txt")
            }

            xhr.open("POST", "{{.Route}}")
            xhr.send(formData)
        })
    </script>
</body>
</html>
`

// Done page
var Done = `
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
        crossorigin="anonymous">
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <title>qrcp</title>
    <style>
        body {
            margin: 10px;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="alert alert-success" role="alert">
            <h4 class="alert-heading">Done!</h4>
            <p>
                Successfully transferred to:<br/> <b>{{.File}}</b>.<br/> You can close this page now.
            </p>
        </div>
    </div>
</body>
</html>
`
